package com.emergency.evaluate.dao;


import com.emergency.evaluate.domain.Weight;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;


import java.util.List;

/**
 * Created by Administrator on 2020/5/14.
 */
public interface WeightDao extends JpaRepository<Weight,String>, JpaSpecificationExecutor<Weight> {

    //根据提取指标ID获取对应的权重
    @Query (value = "select w from Weight w where indicator.id =:indicatorId and scenar.id=:scenarId")
    Weight findAllByIndicatorAndScenar(@Param ( "indicatorId" ) long indicatorId,@Param ( "scenarId" ) long scenarId);
   //根据权重ID获取权重信息
    @Query (value = "select w from Weight w where w.id =:Id ")
    Weight findAllById(@Param ( "Id" ) long Id);
}
